<?php

/**
 * Batch form base class.
 *
 * @package    form
 * @subpackage batch
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseBatchForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'name'          => new sfWidgetFormInput(),
      'startdate'     => new sfWidgetFormDate(),
      'growndate'     => new sfWidgetFormDate(),
      'processeddate' => new sfWidgetFormDate(),
      'marketeddate'  => new sfWidgetFormDate(),
      'enddate'       => new sfWidgetFormDate(),
      'program_id'    => new sfWidgetFormDoctrineSelect(array('model' => 'Program', 'add_empty' => false)),
      'completed'     => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorDoctrineChoice(array('model' => 'Batch', 'column' => 'id', 'required' => false)),
      'name'          => new sfValidatorString(array('max_length' => 100)),
      'startdate'     => new sfValidatorDate(array('required' => false)),
      'growndate'     => new sfValidatorDate(array('required' => false)),
      'processeddate' => new sfValidatorDate(array('required' => false)),
      'marketeddate'  => new sfValidatorDate(array('required' => false)),
      'enddate'       => new sfValidatorDate(array('required' => false)),
      'program_id'    => new sfValidatorDoctrineChoice(array('model' => 'Program')),
      'completed'     => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Batch', 'column' => array('name')))
    );

    $this->widgetSchema->setNameFormat('batch[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Batch';
  }

}